// gym-coach/src/main/java/com/situ/gym/service/impl/CoachServiceImpl.java
package com.situ.gym.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.situ.gym.mapper.CoachMapper;
import com.situ.gym.pojo.Coach;
import com.situ.gym.pojo.query.CoachQuery;
import com.situ.gym.pojo.vo.ChartCountVO;
import com.situ.gym.service.ICoachService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CoachServiceImpl extends ServiceImpl<CoachMapper, Coach> implements ICoachService {

    @Autowired
    private CoachMapper coachMapper;

    @Override
    public IPage<Coach> list(CoachQuery coachQuery) {
        IPage<Coach> page = new Page<>(coachQuery.getPage(),coachQuery.getLimit());
        return coachMapper.list(page,coachQuery);
    }

    @Override
    public void deleteAll(Integer[] ids) {
        coachMapper.deleteAll(ids);
    }

    @Override
    public List<ChartCountVO> selectCoachCount() {
        return coachMapper.selectCoachCount();
    }
    
    @Override
    public List<ChartCountVO> selectUserFavoriteCoach(Integer userId) {
        return coachMapper.selectUserFavoriteCoach(userId);
    }
    
    @Override
    public Coach selectByName(String name) {
        return coachMapper.selectByName(name);
    }
    
    @Override
    public Long selectCoachActiveDays(Integer coachId) {
        return coachMapper.selectCoachActiveDays(coachId);
    }
}